using System;
using System.Reflection;
using Autofac;
using WindowsPhoneMVC;
using Module = Autofac.Module;

namespace NuGetContentSource
{
    public class ApplicationModule : Module
    {
        protected override void Load(ContainerBuilder builder)
        {
            //So save reflection costs, you can do this:
            //builder.Register(c=>new MyController(c.Resolve<Func<ILazyService>>())).AsSelf()
            // for each controller. this has a higher maintainance cost, but better perf (3-10 times faster)

	        builder
                .RegisterAssemblyTypes(Assembly.GetExecutingAssembly())
                .AssignableTo<Controller>()
                .AsSelf();

            //Put container registrations here
            base.Load(builder);
        }
    }
}
